package com.my.study.hutool.core.convert;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.ConverterRegistry;
import com.my.study.utils.Money;
import com.my.study.utils.User;

import java.util.Map;

/**
 * @author: yidujun
 * @create: 2021/06/30 16:05
 */
public class Test {

    public static void main(String[] args) {
        ConverterRegistry instance = ConverterRegistry.getInstance();
        instance.putCustom(Money.class, new MoneyConverter());

        User user = new User("ydj", 12);

        Money convert = Convert.convert(Money.class, user, new Money());
        System.out.println(convert);

        Map<String, String> map = Convert.convert(Map.class, user);
        String name = map.get("userName");
        System.out.println(name);
    }

}
